global root_dir = "`1'"
include "$root_dir/code/config/config.do"

cap noi log using ${log_dir}/tab_A24_data.log, replace name(dat)

capture noi {

    * just a crosswalk to docdb_family_id and then throwing away all patstat parts except docdb
    use ${final_dir}/MP_DHOZ_common_data.dta, clear
    mmerge appln_id using ${commondata_dir}/patstat_2018b/family_info.dta, unmatched(master) ukeep(docdb_family_id)
    drop _m

    keep docdb_family_id automat_puettmann auto90 auto95 pauto90 

    save ${final_dir}/MP_DHOZ_common_data_docdb.dta, replace

}
if _rc == 0 {
    display "Execution finished successfully."
}
else {
    display "Execution finished with errors."
}

cap log close dat